import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vuejsx from "@vitejs/plugin-vue-jsx";
const { resolve } = require("path");
const path = require("path");
let cdnDomian =
  "https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/admin";
let dbhtml = "admin_index.html"


// 根据环境打包设置指定的主页面
console.log(process.env.hj);
console.log('888');
switch (process.env.hj) {
  case "ax": dbhtml = 'index_index.html'; break;
  case "kx": dbhtml = 'kx_index.html'; break;
  case "wzfb": cdnDomian="https://dx-1258272853.cos.ap-guangzhou.myqcloud.com/admin";break
  case "jyjc": cdnDomian="https://dx-1306415990.cos.ap-guangzhou.myqcloud.com/admin";break
  case "xjyx": dbhtml = 'index_index.html'; cdnDomian="https://xjyx-1257123710.cos.ap-shanghai.myqcloud.com/admin";break
  case "skzn": dbhtml =  "index_index.html";cdnDomian="https://sk-1318480445.cos.ap-guangzhou.myqcloud.com/admin";break
}
console.log(dbhtml);

const cig = {
  base: process.env.NODE_ENV == "dev" ? "./" : cdnDomian,
  plugins: [vue(), vuejsx()],
  server: {
    host:"0.0.0.0",
    port: "3009",
  },
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, dbhtml),
      },
    },
  },
};
export default defineConfig(cig);
